import type { AddressItem, AddressParams } from '@/types/address'
import { http } from '@/utils/http'
import request from '@/utils/request'

/**
 * 登录
 */
export const Login = (data: { phone: string; password: string }) => {
  return http({
    url: 'http://localhost:8090/user/login',
    method: 'POST',
    data,
  })
}

/**
 * 查询全部 user
 */
export const getUserInfo = () => {
  return http({
    url: 'http://localhost:8090/user/find',
    method: 'GET',
  })
}

/**
 * 根据id查找用户信息
 * @param uid
 * @returns {*}
 * @constructor
 */
export const My = (uid: string) => {
  return http({
    url: 'http://localhost:8090/user/myUser',
    method: 'POST',
    data: {
      uid: uid,
    },
  })
}

/**
 * 上传头像
 */
export const uploadAvatar = (data: any) => {
  return http({
    url: 'http://localhost:8090/user/uphotoUp',
    method: 'POST',
    data,
  })
}
